/*
 * $Id: PerforceCatchupReleaseViewer.java 20 2002-08-04 11:04:46Z bpruessmann $
 * 
 * Copyright (c) 2001 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.ui.sync;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer;
import org.eclipse.team.internal.ui.sync.SyncView;

/**
  * @version 	$Revision: 20 $
  * @author		<a href="mailto:bpruessmann@users.sourceforge.net">Boris Pruessmann</a>
  */
public class PerforceCatchupReleaseViewer extends CatchupReleaseViewer
{
	private SyncAction syncMergeAction;
	private ResolveAction resolveAction;
	
	/**
	 * Constructor for PerforceCatchupReleaseViewer.
	 * @param parent
	 * @param model
	 */
	public PerforceCatchupReleaseViewer(Composite parent, PerforceSyncCompareInput model)
	{
		super(parent, model);
		
		syncMergeAction = new SyncAction(model, this, "Sync to Head Revision", parent.getShell());
//		resolveAction = new ResolveAction(model, this, "Resolve interactively", parent.getShell());
	}

	/*
	 * @see DiffTreeViewer#fillContextMenu(IMenuManager)
	 */
	protected void fillContextMenu(IMenuManager manager) 
	{
		super.fillContextMenu(manager);

		manager.add(new Separator());
		switch (getSyncMode()) 
		{
			case SyncView.SYNC_INCOMING:
				syncMergeAction.update(SyncView.SYNC_INCOMING);
				manager.add(syncMergeAction);
//				resolveAction.update(SyncView.SYNC_INCOMING);
//				manager.add(resolveAction);
				break;

			case SyncView.SYNC_OUTGOING:
				//commitAction.update(SyncView.SYNC_OUTGOING);
				//manager.add(commitAction);
				//ignoreAction.update();
				//manager.add(ignoreAction);
				//manager.add(new Separator());
				//updateAction.update(SyncView.SYNC_OUTGOING);
				//manager.add(updateAction);
				break;
				
			case SyncView.SYNC_BOTH:
				//commitAction.update(SyncView.SYNC_BOTH);
				//manager.add(commitAction);
				//manager.add(new Separator());
				//updateAction.update(SyncView.SYNC_BOTH);
				//manager.add(updateAction);
				break;
				
			case SyncView.SYNC_MERGE:
				resolveAction.update(SyncView.SYNC_INCOMING);
				manager.add(resolveAction);
				break;
		}
	}

}
